{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "y_predict:[410.27857031 377.1122433  343.94591629 957.52296598 343.94591629\n",
      " 493.19438784]\n",
      "train score:0.9718882973567396\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAeVUlEQVR4nO3debgdVZnv8e/PJMAhIkE4RkjAIKRDA8rgEaKglzmASHBCbJWAXLjYKCAaIV5axPa2RBwRGzuEhoDMECCtSIhBxKuCZoIwGI0IksOQAyZhSBpCePuPWntn53CGOjm7dp3h93me/eyqVatqv7sg5921Vq1VigjMzMwA3lB2AGZm1nc4KZiZWZWTgpmZVTkpmJlZlZOCmZlVDS07gN7YZpttYsyYMWWHYWbWr8yfP//ZiGjuaFu/Tgpjxoxh3rx5ZYdhZtavSHq8s21uPjIzsyonBTMzq3JSMDOzKicFMzOrclIwM7Oqfn33kZnZYHLrwlYunL2EJ1euYbsRTUyeMI5j9hpV189wUjAz6wduXdjKlJmLWbN2HQCtK9cwZeZigLomBjcfmZn1AxfOXlJNCBVr1q7jwtlL6vo5TgpmZv3AkyvX9Kh8YzkpmJn1A9uNaOpR+cZyUjAz6wcmTxhH07AhG5Q1DRvC5Anj6vo57mg2M+sHKp3JvvvIzMyALDHUOwm05+YjMzOrclIwM7MqJwUzM6tyUjAzsyonBTMzq3JSMDOzKicFMzOrclIwM7MqJwUzM6sqNClIOkPSg5IeknRmKnuzpDmS/pzet0rlknSRpKWSHpC0d5GxmZnZ6xWWFCTtDpwM7APsARwlaWfgHGBuRIwF5qZ1gCOAsel1CnBJUbGZmVnHirxS+Efg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MpJwczMqpwUzMysyknBzMyq/gfjz4K1XN12sgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.linear_model import Lasso\n",
    "\n",
    "x_train = np.array([1.7, 1.5, 1.3, 5, 1.3, 2.2])\n",
    "\n",
    "y_train = np.array([368, 340, 376, 954, 332, 556])\n",
    "'''\n",
    "alpha:目标函数J（W;lanbuta）中的lanbuta\n",
    "fit_intercept/normalize/copy_x意义同LinearRegression\n",
    "'''\n",
    "lasso = Lasso(1.0, True, True, False)\n",
    "#在scikit-learn中，训练数据x是二维数组，例子中是单维特征，需要变成二维数组\n",
    "x_train = x_train.reshape(-1, 1)\n",
    "#训练模型参数\n",
    "lasso.fit(x_train, y_train)\n",
    "y_predict = lasso.predict(x_train)\n",
    "print(\"y_predict:{}\".format(y_predict))\n",
    "score = lasso.score(x_train, y_train)\n",
    "print(\"train score:{}\".format(score))\n",
    "plt.scatter(x_train, y_train, label=\"Train Simples\")\n",
    "\n",
    "plt.xlabel(\"online advertising dollars\")\n",
    "plt.ylabel(\"monthly e-commenerce sales\")\n",
    "plt.show()\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
